import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login/login',
    method: 'post',
    data: data,
    handleError:true,
  })
}

export function getInfo(token) {
  return request({
    url: '/info',
    method: 'get',
  })
}




export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

/**
 * 校验密码是否正确
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function checkPassword(data){
  return request({
    url: '/user/checkPassword',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 修改密码
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function resetPassword(data){
  return request({
    url: '/user/resetPassword',
    method: 'post',
    data,
    handleError: true,
  })
}

export function checkForgetPassword(data){
  return request({
    url: '/user/forgetCheck',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 发送邮件
 * @param email
 * @returns {Promise | Promise<unknown>}
 */
export function sendEmailCode(email){
  return request({
    url: '/user/sendEmailCode',
    method: 'get',
    params: {
      email,
    },
    handleError: true,
  })
}

/**
 * 获取充值记录列表
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getRechargeRecordData(params){
  return request({
    url: '/user/getRechargeRecordData',
    params,
  })
}
//获取运营列表
export function getUserList(params) {
  return request({
    url: '/user/getUserList',
    method: 'get',
    params,
  })
}
//获取运营列表
export function createUser(data) {
  return request({
    url: '/user/createUser',
    method: 'post',
    data,
    handleError: true,
  })
}

export function editUserLogShow(data){
  return request({
    url:'/user/editUserLogShow',
    method:'post',
    data:{
      ...data
    },
    handleError: true,
  })
}

export function getIsShowLog(params){
  return request({
    url: `/user/getIsShowLog`,
    method: 'get',
    params:{
      ...params
    }
  })
}



